package maitaole.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author lcw
 * @Description 类的功能描述
 * @Date 2023/4/20
 */
public class DateUtils {

    //
    static SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");

    //字符串==》 date
    public static Date  strToDate(String d) {

        try {
           return sdf.parse(d);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return  null;

    }

    // date==> String
    public  static  String dateToStr(Date d) {

      return   sdf.format(d);

    }


    //java.uti.date ==> java.sql.date
    public static java.sql.Date  toDate2(Date d) {

      return   new java.sql.Date(d.getTime());

    }



}
